#ifndef CORE_CONSTANT_MEDIUM_H
#define CORE_CONSTANT_MEDIUM_H
#include "Hitable.h"
#include "Material.h"
#include "Texture.h"
#include "Isotropic.h"
namespace RayTracer
{
	class Medium : public Hitable {
	public:
		Medium(std::shared_ptr<Hitable> b, double d, std::shared_ptr<Texture> a)
			: boundary(b),
			neg_inv_density(-1 / d),
			phase_function(std::make_shared<Isotropic>(a))
		{}

		Medium(std::shared_ptr<Hitable> b, float d, vec3 c)
			: boundary(b), neg_inv_density(-1 / d),
			phase_function(std::make_shared<Isotropic>(c))
		{}

		virtual bool Hit(
			const Ray& r, float t_min, float t_max, HitRecord& rec) const override;

		virtual bool BoundingBox(AABB& output_box) const override {
			return boundary->BoundingBox(output_box);
		}

	public:
		std::shared_ptr<Hitable> boundary;
		std::shared_ptr<Material> phase_function;
		double neg_inv_density;
	};
}
#endif